Indonesia is the largest country in Southeast Asia.Rice is the primary staple food crop with a steady increase in annual production, making Indonesia the third largest rice producer in the world. 93% of Indonesia’s total number of farmers are small family farms. Rice is the main crop grown and staple food in Southeast Asia. Crop rotation is the practice of planting different crops sequentially on the same plot of land to improve soil health, optimize nutrients in the soil, and combat pest and weed pressure. - Soybean (Glycine max) is a species of legume native to East Asia, widely grown for its edible bean which has numerous uses. - Chili (Capsicum annum L.) is a plant of tropical and subtropical regions for their fleshy fruits
Rice farm with crop rotation. Crop rotation for this project is chilli ana soybean. Total cost per crop are consists of labor, seeds, pesticides, fertilizer, machinery and rent land. Moreover, Revenues is yield of rice, soybean and chilli. Finally, total cost, revenues and discount rate use put to calculate to Net Present Value(NVP).
read.csv("new_variable_estimates.csv",sep=";")
## description label
## 1 Rice production Rice yield
## 2 Rice production Rice price
## 3 Rice cultivation cost Rent land of rice
## 4 Rice cultivation cost Cost of rice seeds
## 5 Rice cultivation cost Cost of fertilizer for rice
## 6 Rice cultivation cost Cost of pesticide for rice
## 7 Rice cultivation cost Cost of labor for rice
## 8 Rice cultivation cost Cost of machinery for rice
## 9 Rice cultivation cost Cost of harvesting for rice
## 10 Soybean production Soybean yield
## 11 Soybean production Soybean price
## 12 Soybean cultivation cost Rent land of soybean
## 13 Soybean cultivation cost Cost of seeds for soybean
## 14 Soybean cultivation cost Cost of fertilizer for soybean
## 15 Soybean cultivation cost Cost of pesticide for soybean
## 16 Soybean cultivation cost Cost of labor for soybean
## 17 Soybean cultivation cost Cost of machinery for soybean
## 18 Soybean cultivation cost Cost of harvesting for soybean
## 19 Chili production Chili yield
## 20 Chili production Chili price
## 21 Chili cultivation cost Rent land of chili
## 22 Chili cultivation cost Cost of seeds for chili
## 23 Chili cultivation cost Cost of fertilizer for chili
## 24 Chili cultivation cost Cost of pesticide for chili
## 25 Chili cultivation cost Cost of labor for chili
## 26 Chili cultivation cost Cost of machinery for chili
## 27 Chili cultivation cost Cost of mulch
## 28 Chili cultivation cost Cost of growth support (polybag, rope, stick, net)
## 29 Chili cultivation cost Cost of fuel and electricity
## 30 Chili cultivation cost Cost of harvesting for chili
## 31 Discount rate Discount rate
## 32 Year Year of observation
## variable distribution lower median upper unit
## 1 rice_yield posnorm 3.00e+03 NA 6.0e+03 kg/ha
## 2 rice_price posnorm 4.00e+03 NA 7.0e+03 IDR/kg
## 3 rice_land_rental_cost posnorm 2.00e+06 NA 4.0e+06 IDR/ha
## 4 rice_seeds_cost posnorm 4.00e+05 NA 6.0e+05 IDR/ha
## 5 rice_fertilizer_cost posnorm 1.00e+06 NA 1.5e+06 IDR/ha
## 6 rice_pesticide_cost posnorm 4.30e+05 NA 6.0e+05 IDR/ha
## 7 rice_labor_cost posnorm 5.00e+06 NA 7.0e+06 IDR/ha
## 8 rice_machinery_cost posnorm 2.00e+05 NA 5.0e+05 IDR/ha
## 9 rice_harvesting_cost posnorm 1.00e+05 NA 2.0e+05 IDR/ha
## 10 soybean_yield posnorm 2.00e+03 NA 3.0e+03 kg/ha
## 11 soybean_price posnorm 5.00e+03 NA 1.0e+04 IDR/kg
## 12 soybean_land_rental_cost posnorm 1.53e+06 NA 3.0e+06 IDR/ha
## 13 soybean_seeds_cost posnorm 5.00e+05 NA 6.5e+05 IDR/ha
## 14 soybean_fertilizer_cost posnorm 3.50e+06 NA 5.5e+06 IDR/ha
## 15 soybean_pesticide_cost posnorm 3.00e+05 NA 4.5e+05 IDR/ha
## 16 soybean_labor_cost posnorm 3.50e+06 NA 5.5e+06 IDR/ha
## 17 soybean_machinery_cost posnorm 1.00e+05 NA 2.0e+05 IDR/ha
## 18 soybean_harvesting_cost posnorm 5.00e+04 NA 1.0e+05 IDR/ha
## 19 chili_yield posnorm 8.00e+03 NA 1.0e+04 kg/ha
## 20 chili_price posnorm 1.00e+04 NA 5.0e+04 IDR/kg
## 21 chili_land_rental_cost posnorm 3.50e+06 NA 5.5e+06 IDR/ha
## 22 chili_seeds_cost posnorm 2.00e+06 NA 3.0e+06 IDR/ha
## 23 chili_fertilizer_cost posnorm 7.50e+06 NA 8.5e+06 IDR/ha
## 24 chili_pesticide_cost posnorm 4.50e+06 NA 6.0e+06 IDR/ha
## 25 chili_labor_cost posnorm 3.00e+07 NA 3.5e+07 IDR/ha
## 26 chili_machinery_cost posnorm 1.00e+06 NA 2.7e+06 IDR/ha
## 27 chili_mulch_cost posnorm 2.50e+06 NA 3.5e+06 IDR/ha
## 28 chili_growing_support_cost posnorm 2.00e+06 NA 3.0e+06 IDR/ha
## 29 chili_fuel_electricity_cost posnorm 1.00e+06 NA 3.0e+06 IDR/ha
## 30 chili_harvesting_cost posnorm 1.00e+05 NA 2.0e+05 IDR/ha
## 31 discount_rate posnorm 1.00e-02 NA 5.0e-02
## 32 n_year const 1.00e+01 NA 1.0e+01
crop_rotation_decision <- function(){
# Estimate the income of rice in a normal season
rice_income <- rice_yield * rice_price
# Estimate the income of soybean in a normal season
soybean_income <- soybean_yield * soybean_price
# Estimate the income of chili in a normal season
chili_income <- chili_yield * chili_price
#Estimate the cost of rice farm in a normal season
rice_cost <- sum(rice_land_rental_cost, rice_seeds_cost, rice_fertilizer_cost,
rice_pesticide_cost, rice_machinery_cost, rice_harvesting_cost)
#Estimate the cost of soybean farm in a normal season
soybean_cost <- sum(soybean_land_rental_cost, soybean_seeds_cost, soybean_fertilizer_cost,
soybean_pesticide_cost, soybean_machinery_cost, soybean_harvesting_cost)
#Estimate the cost in a normal season
chili_cost <- sum(chili_land_rental_cost, chili_seeds_cost, chili_fertilizer_cost,
chili_pesticide_cost, chili_machinery_cost, chili_harvesting_cost)
# Estimate the profit
rice_profit <- vv(rice_income - rice_cost,n=n_year,var_CV=100)
soybean_profit <- vv(soybean_income - soybean_cost,n=n_year,var_CV=100)
chili_profit <- vv(chili_income - chili_cost,n=n_year,var_CV=100)
# Final result
crop_rotation_result = rice_profit + soybean_profit + chili_profit
rice_cultivation_result = rice_profit*3
# NPV
NPV_crop_rotation <- discount(crop_rotation_result, discount_rate, calculate_NPV = TRUE)
NPV_rice <- discount(rice_cultivation_result, discount_rate, calculate_NPV = TRUE)
NPV_crop_rotation_income <- discount(rice_income + soybean_income + chili_income, discount_rate, calculate_NPV = TRUE)
NPV_rice_income <- discount(rice_income, discount_rate, calculate_NPV = TRUE)
NPV_crop_rotation_cost <- discount(rice_cost + soybean_cost + chili_cost, discount_rate, calculate_NPV = TRUE)
NPV_rice_cost <- discount(rice_cost, discount_rate, calculate_NPV = TRUE)
# Generate the list of outputs from the Monte Carlo simulation
return(list(NPV_crop_rotation=NPV_crop_rotation, NPV_rice=NPV_rice,
NPV_crop_rotation_income=NPV_crop_rotation_income, NPV_rice_income=NPV_rice_income,
NPV_crop_rotation_cost=NPV_crop_rotation_cost, NPV_rice_cost=NPV_rice_cost,
crop_rotation_result=crop_rotation_result,
rice_cultivation_result=rice_cultivation_result))
}
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
Variable for rice farm and crop rotation for small holder farmers in Indonesia have 8 mains variable and this consists of production, rice cultivation cost, soybean production, soybean cultivation cost, chilli production, chilli cultivation cost, discount rate and year of system. This project use 37 variable estimate to calculate
>>>>>>> bf024e6035a71fa6a7d54b0fe9e326570042b703Do, Luedeling, and Whitney (2020)
crop_rotation_decision <- function(){
# Estimate the income of rice in a normal season
rice_income <- vv(rice_yield * rice_price, n=n_year, var_CV=100)
# Estimate the income of soybean in a normal season
soybean_income <- vv(soybean_yield * soybean_price, n=n_year, var_CV=100)
# Estimate the income of chili in a normal season
chili_income <- vv(chili_yield * chili_price, n=n_year, var_CV=100)
#Estimate the cost of rice farm in a normal season
rice_cost_precal <- sum(rice_land_rental_cost, rice_seeds_cost, rice_fertilizer_cost,
rice_pesticide_cost, rice_machinery_cost, rice_harvesting_cost)
rice_cost <- vv(rice_cost_precal, n=n_year, var_CV=100)
#Estimate the cost of soybean farm in a normal season
soybean_cost_precal <- sum(soybean_land_rental_cost, soybean_seeds_cost, soybean_fertilizer_cost,
soybean_pesticide_cost, soybean_machinery_cost, soybean_harvesting_cost)
soybean_cost <- vv(soybean_cost_precal, n=n_year, var_CV=100)
#Estimate the cost in a normal season
chili_cost_precal <- sum(chili_land_rental_cost, chili_seeds_cost, chili_fertilizer_cost,
chili_pesticide_cost, chili_machinery_cost, chili_harvesting_cost)
chili_cost <- vv(chili_cost_precal, n=n_year, var_CV=100)
# Estimate the profit
rice_profit <- vv(rice_income - rice_cost, n=n_year, var_CV=100)
soybean_profit <- vv(soybean_income - soybean_cost, n=n_year, var_CV=100)
chili_profit <- vv(chili_income - chili_cost, n=n_year, var_CV=100)
# Final result
#assuming rice cultivation is 3 times per year
rice_cultivation_result = vv(rice_profit*3, n=n_year, var_CV=100)
#crop rotation decision scenario
#if crop rotation of 3 crops is done in one year
crop_rotation_result = vv(rice_profit + soybean_profit + chili_profit, n=n_year, var_CV=100)
#if crop rotation of rice and soybean is done in one year (rice-soybean-rice)
rice_soybean_result = vv((rice_profit*2) + soybean_profit, n=n_year, var_CV=100)
#if crop rotation of rice and chili is done in one year (rice-chili)
rice_chili_result = vv(rice_profit + chili_profit, n=n_year, var_CV=100)
# NPV
NPV_rice <- discount(rice_cultivation_result, discount_rate, calculate_NPV = TRUE)
NPV_crop_rotation <- discount(crop_rotation_result, discount_rate, calculate_NPV = TRUE)
NPV_rice_soybean <- discount(rice_soybean_result, discount_rate, calculate_NPV = TRUE)
NPV_rice_chili <- discount(rice_chili_result, discount_rate, calculate_NPV = TRUE)
# Cashflow
cashflow_crop_rotation <- crop_rotation_result - rice_cultivation_result
cashflow_rice_soybean <- rice_soybean_result - rice_cultivation_result
cashflow_rice_chili <- rice_chili_result - rice_cultivation_result
# Generate the list of outputs from the Monte Carlo simulation
return(list(Rice_NPV = NPV_rice,
crop_rotation_NPV = NPV_crop_rotation,
rice_soybean_NPV = NPV_rice_soybean,
rice_chili_NPV= NPV_rice_chili,
NPV_decision_crop_rotation = NPV_crop_rotation - NPV_rice,
NPV_decision_rice_soybean = NPV_rice_soybean - NPV_rice,
NPV_decision_rice_chili = NPV_rice_chili - NPV_rice,
cashflow_crop_rotation = cashflow_crop_rotation,
cashflow_rice_soybean = cashflow_rice_soybean,
cashflow_rice_chili = cashflow_rice_chili
))
}
make_variables<-function(est,n=1)
{ x<-random(rho=est, n=n)
for(i in colnames(x)) assign(i, as.numeric(x[1,i]),envir=.GlobalEnv)}
make_variables(read.csv("new_variable_estimates.csv"))
## Warning in assign(i, as.numeric(x[1, i]), envir = .GlobalEnv): NAs introduced
## by coercion
# Run the Monte Carlo simulation using the model function
input_estimates <- read.csv("new_variable_estimates.csv", sep=";")
crop_rotation_mc_simulation <- mcSimulation(estimate = as.estimate(input_estimates),
model_function = crop_rotation_decision,
numberOfModelRuns = 1000,
functionSyntax = "plainNames")
# Run the Monte Carlo simulation using the model function
input_estimates <- read.csv("new_variable_estimates.csv", sep=";")
crop_rotation_mc_simulation <- mcSimulation(estimate = as.estimate(input_estimates),
model_function = crop_rotation_decision,
numberOfModelRuns = 1000,
functionSyntax = "plainNames")
#if rice with soybean and chili (rice-soybean-chili)
decisionSupport::plot_distributions(mcSimulation_object = crop_rotation_mc_simulation,
vars = c("NPV_decision_crop_rotation", "Rice_NPV"),
method = 'smooth_simple_overlay')
decisionSupport::plot_distributions(mcSimulation_object = crop_rotation_mc_simulation,
vars = "NPV_decision_crop_rotation",
method = 'boxplot')
#if rice with soybean (rice-soybean-rice)
decisionSupport::plot_distributions(mcSimulation_object = crop_rotation_mc_simulation,
vars = c("NPV_decision_rice_soybean","Rice_NPV"),
method = 'smooth_simple_overlay')
decisionSupport::plot_distributions(mcSimulation_object = crop_rotation_mc_simulation,
vars = "NPV_decision_rice_chili",
method = 'boxplot')
#if rice with chili (rice-chili)
decisionSupport::plot_distributions(mcSimulation_object = crop_rotation_mc_simulation,
vars = c("NPV_decision_rice_chili","Rice_NPV"),
method = 'smooth_simple_overlay')
decisionSupport::plot_distributions(mcSimulation_object = crop_rotation_mc_simulation,
vars = "NPV_decision_rice_chili",
method = 'boxplot')
plot_cashflow(mcSimulation_object = crop_rotation_mc_simulation, cashflow_var_name = "cashflow_crop_rotation")
plot_cashflow(mcSimulation_object = crop_rotation_mc_simulation, cashflow_var_name = "cashflow_rice_soybean")
plot_cashflow(mcSimulation_object = crop_rotation_mc_simulation, cashflow_var_name = "cashflow_rice_chili")
mcSimulation_table <- data.frame(crop_rotation_mc_simulation$x, crop_rotation_mc_simulation$y[1:7])
evpi_crop_rotation <- multi_EVPI(mc = mcSimulation_table, first_out_var = "crop_rotation_NPV")
## [1] "Processing 6 output variables. This can take some time."
## [1] "Output variable 1 (crop_rotation_NPV) completed."
## [1] "Output variable 2 (rice_soybean_NPV) completed."
## [1] "Output variable 3 (rice_chili_NPV) completed."
## [1] "Output variable 4 (NPV_decision_crop_rotation) completed."
## [1] "Output variable 5 (NPV_decision_rice_soybean) completed."
## [1] "Output variable 6 (NPV_decision_rice_chili) completed."
plot_evpi(evpi_crop_rotation, decision_vars = "NPV_decision_crop_rotation")
evpi_rice_soybean <- multi_EVPI(mc = mcSimulation_table, first_out_var = "rice_soybean_NPV")
## [1] "Processing 5 output variables. This can take some time."
## [1] "Output variable 1 (rice_soybean_NPV) completed."
## [1] "Output variable 2 (rice_chili_NPV) completed."
## [1] "Output variable 3 (NPV_decision_crop_rotation) completed."
## [1] "Output variable 4 (NPV_decision_rice_soybean) completed."
## [1] "Output variable 5 (NPV_decision_rice_chili) completed."
plot_evpi(evpi_rice_soybean, decision_vars = "NPV_decision_rice_soybean")
evpi_rice_chili <- multi_EVPI(mc = mcSimulation_table, first_out_var = "rice_chili_NPV")
## [1] "Processing 4 output variables. This can take some time."
## [1] "Output variable 1 (rice_chili_NPV) completed."
## [1] "Output variable 2 (NPV_decision_crop_rotation) completed."
## [1] "Output variable 3 (NPV_decision_rice_soybean) completed."
## [1] "Output variable 4 (NPV_decision_rice_chili) completed."
plot_evpi(evpi_rice_chili, decision_vars = "NPV_decision_rice_chili")
pls_result_crop_rotation <- plsr.mcSimulation(object = crop_rotation_mc_simulation,
resultName = names(crop_rotation_mc_simulation$y)[5], ncomp = 1)
plot_pls(pls_result_crop_rotation, threshold = 0)
pls_result_rice_soybean <- plsr.mcSimulation(object = crop_rotation_mc_simulation,
resultName = names(crop_rotation_mc_simulation$y)[6], ncomp = 1)
plot_pls(pls_result_rice_soybean, threshold = 0)
pls_result_rice_chili <- plsr.mcSimulation(object = crop_rotation_mc_simulation,
resultName = names(crop_rotation_mc_simulation$y)[7], ncomp = 1)
plot_pls(pls_result_rice_chili, threshold = 0)
compound_figure(mcSimulation_object = crop_rotation_mc_simulation,
input_table = input_estimates, plsrResults = pls_result_crop_rotation,
EVPIresults = evpi_crop_rotation, decision_var_name = "NPV_decision_crop_rotation",
cashflow_var_name = "cashflow_crop_rotation",
base_size = 7)
compound_figure(mcSimulation_object = crop_rotation_mc_simulation,
input_table = input_estimates, plsrResults = pls_result_rice_soybean,
EVPIresults = evpi_rice_soybean, decision_var_name = "NPV_decision_rice_soybean",
cashflow_var_name = "cashflow_rice_soybean",
base_size = 7)
compound_figure(mcSimulation_object = crop_rotation_mc_simulation,
input_table = input_estimates, plsrResults = pls_result_rice_chili,
EVPIresults = evpi_rice_chili, decision_var_name = "NPV_decision_rice_chili",
cashflow_var_name = "cashflow_rice_chili",
base_size = 7)
It is highly recommended for Indonesian smallholder farmers to implement three crop rotations (rice, soybean, and chili) as it is more suitable for sustainable development.
Crop rotation is crucial for maintaining the soil’s physical, chemical, and biological properties, as well as for improving crop yields and farmers’ income.